package logic

import (
	"context"
	"homepage_srv/homepage"
	"homepage_srv/internal/dao"
	"homepage_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type CartDelLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCartDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CartDelLogic {
	return &CartDelLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *CartDelLogic) CartDel(in *homepage.CartDelRequest) (*homepage.CartDelResponse, error) {
	// todo: add your logic here and delete this line
	dao.DelCart(int(in.UserId))
	return &homepage.CartDelResponse{Msg: "清空购物车成功"}, nil
}
